package com.suliao.home.serviceImpl.sys;

import com.suliao.home.entity.sys.UserDO;
import com.suliao.home.mapper.sys.UserMapper;
import com.suliao.home.service.sys.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author： M1nG-CodeGenerator
 * @since： 2020-12-18 14:25:38
 * @description： 用户表 服务实现类
 * @version： 1.0
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements UserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * 通过用户id获取用户信息
     * @param userId
     * @return
     */
    @Override
    public UserDO getUserById(Integer userId) {
        return userMapper.getUserById(userId);
    }

    /**
     * 根据用户名和密码查看登录用户是否存在
     * @param userName
     * @param md6
     * @return
     */
    @Override
    public UserDO getLoginDoorUser(String userName, String md6) {
        return userMapper.getLoginDoorUser(userName,md6);
    }

    /**
     * 判断用户名是否重复
     * @param userName
     * @return
     */
    @Override
    public UserDO selectByName(String userName) {
        return userMapper.selectByName(userName);
    }

    /**
     * 判断手机号是否重复
     * @param userPhone
     * @return
     */
    @Override
    public UserDO selectByPhone(String userPhone) {
        return userMapper.selectByPhone(userPhone);
    }

    /**
     * 注册
     * @param userDO
     * @return
     */
    @Override
    public int registration(UserDO userDO) {
        return userMapper.registration(userDO);
    }

    /**
     * 通过账号名称修改密码
     * @param newPassword
     * @param userName
     * @return
     */
    @Override
    public int updUserByAccountName(String newPassword, String userName) {
        return userMapper.updUserByAccountName(newPassword,userName);
    }

    /**
     * 通过公司id获取用户信息
     * @param companyId
     * @return
     */
    @Override
    public UserDO getUserByCompanyId(Integer companyId) {
        return userMapper.getUserByCompanyId(companyId);
    }
}
